<template>
  <el-select
    :value="value"
    @change="$emit('input', $event)"
    placeholder="请选择学科"
  >
    <el-option
      v-for="item in subjectOpts"
      :key="item.id"
      :label="item.short_name"
      :value="item.id"
    ></el-option>
  </el-select>
</template>

<script>
import { subjectList } from '../../../api/subject'

export default {
  name: 'subSelect',
  props: ['value'],
  data () {
    return {
      subjectOpts: []
    }
  },
  methods: {
    // changeHandler (value) {
    //   console.log('value:', value)
    //   this.$emit('input',value)
    // }
  },
  created () {
    subjectList().then(res => {
      this.subjectOpts = res.data.data.items
    })
  }
}
</script>

<style></style>
